
capture cd "c:\users\\`c(username)'\dropbox\TingleyCostaRica\ISQ\data"
capture cd "c:\Users\\`c(username)'\Documents\My Dropbox\TingleyCostaRica\ISQ\data"

use CR_ISQdistrict.dta  , clear

local targetind2 "AgricExports ManufExports PcntTextile "
local targetind " ManufExports   "
local rv "BrozExport BrozImport"
local ss "PcntLowSocEcon_SD"
local control "totalunemp pubempperc"
local controlfe "pubempperc"
local edu "colortv"
local ftz "ftzbusinesses_dum"
local cluster "cl(cantonid)"

local i=1
estimates clear
reg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06  pct_Libertario_leg06  `targetind' `ftz' `ss' `control' `edu', robust `cluster'
est store Leg`i'
local i=`i'+1

summ pct_PLN_leg06, d
gen pct_PLN_leg06_md_dich=1 if pct_PLN_leg06>r(p50) & pct_PLN_leg06~=.
replace pct_PLN_leg06_md_dich=0 if pct_PLN_leg06<=r(p50) & pct_PLN_leg06~=.
psmatch2   pct_PLN_leg06_md_dich  PcntLowSocEcon_SD , out(perc_yes) ate common norepl

reg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06  pct_Libertario_leg06  `targetind' `ftz' `ss' `control' `edu' if _support~=0, robust `cluster'

xtreg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06 pct_Libertario_leg06  `targetind' `ss' `controlfe' `edu' `ftz'  , robust  `cluster' fe
xtreg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06 pct_Libertario_leg06  `targetind' `ss' `controlfe' `edu' `ftz'  if _support~=0 , robust  `cluster' fe

areg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06 pct_Libertario_leg06  `targetind' `ss' `controlfe' `edu' `ftz'  , robust  `cluster' abs(cantonnumb)
areg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06 pct_Libertario_leg06  `targetind' `ss' `controlfe' `edu' `ftz' if _support~=0  , robust  `cluster' abs(cantonnumb)


use CR_ISQ_ED.dta , clear
local targetind2 "AgricExports ManufExports PcntTextile "
local targetind " ManufExports   "
local rv "BrozExport BrozImport"
local ss "PcntLowSocEcon_SD"
local control "totalunemp pubempperc"
local controlfe "pubempperc"
*local edu "universityeduc"
*local edu "colortv universityeduc"
local edu "colortv"
local ftz "ftzbusinesses_dum"
local cluster "cl(cantonnumb)"
summ pct_PLN_leg06, d
gen pct_PLN_leg06_md_dich=1 if pct_PLN_leg06>r(p50) & pct_PLN_leg06~=.
replace pct_PLN_leg06_md_dich=0 if pct_PLN_leg06<=r(p50) & pct_PLN_leg06~=.
psmatch2   pct_PLN_leg06_md_dich  PcntLowSocEcon_SD , out(perc_yes) ate common norepl
areg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06 pct_Libertario_leg06  `targetind' `ss' `controlfe' `edu' `ftz'  , robust  `cluster' abs(cantonnumb)
areg perc_yes pct_PLN_leg06 pct_PAC_leg06 pct_PUSC_leg06 pct_Libertario_leg06  `targetind' `ss' `controlfe' `edu' `ftz'  if _support~=0  , robust  `cluster' abs(cantonnumb)

